"use client";

interface JsonViewerProps {
  data: any;
}

export default function JsonViewer({ data }: JsonViewerProps) {
  if (!data) {
    return (
      <div className="border rounded-lg p-6 h-full bg-gray-50 dark:bg-gray-800">
        <p className="text-gray-500 dark:text-gray-400 text-center">
          上传 Excel 文件后，解析结果将显示在这里
        </p>
      </div>
    );
  }

  return (
    <div className="border rounded-lg p-4 bg-gray-50 dark:bg-gray-800 overflow-auto max-h-[600px]">
      <h2 className="text-lg font-semibold mb-4">解析结果</h2>
      <pre className="text-sm whitespace-pre-wrap break-words">
        {JSON.stringify(data, null, 2)}
      </pre>
    </div>
  );
} 